Skip to content

fix(backend): include thread_id in between-run listener events URL#1687

Merged
markturansky merged 1 commit into
ambient-code:mainfrom
markturansky:fix/between-run-listener-404
Jun 15, 2026
Merged

fix(backend): include thread_id in between-run listener events URL#1687
markturansky merged 1 commit into
ambient-code:mainfrom
markturansky:fix/between-run-listener-404

Conversation

@markturansky

@markturansky markturansky commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The between-run listener (listenBetweenRunEvents) was constructing the runner SSE URL as GET /events without the required {thread_id} path parameter, causing 404 errors from the runner pod
  • Fixed by appending sessionName (which is the thread_id convention) to the events URL: /events/{sessionName}

Root Cause

The runner's SSE tap endpoint is GET /events/{thread_id} (components/runners/ambient-runner/ambient_runner/endpoints/events.py:45). Without the path parameter, FastAPI returns 404.

Test plan

  • Deploy to UAT and verify runner pod logs no longer show GET /events HTTP/1.1 404
  • Verify between-run events (e.g., background task completions) are captured and displayed in the frontend
  • Verify existing run-initiated SSE streaming continues to work normally

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved session event handling reliability by implementing session-specific event routing on the backend.

The between-run listener was connecting to GET /events without the
required thread_id path parameter, causing 404s from the runner.
The runner endpoint is GET /events/{thread_id} — append sessionName.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@netlify

netlify Bot commented Jun 15, 2026

Copy link
Copy Markdown

Deploy Preview for cheerful-kitten-f556a0 canceled.

Name Link
🔨 Latest commit b9e12ee
🔍 Latest deploy log https://app.netlify.com/projects/cheerful-kitten-f556a0/deploys/6a3064122d270e0008699ee4

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 704158d6-c0e6-4b51-921d-285fb39676a5

📥 Commits

Reviewing files that changed from the base of the PR and between d3ee37a and b9e12ee.

📒 Files selected for processing (1)
  • components/backend/websocket/agui_proxy.go

📝 Walkthrough

Walkthrough

listenBetweenRunEvents in the WebSocket proxy changes its runner SSE endpoint from the generic /events path to /events/{sessionName}, scoping the connection to a specific session.

Changes

Session-scoped SSE endpoint

Layer / File(s) Summary
SSE URL update
components/backend/websocket/agui_proxy.go
listenBetweenRunEvents appends sessionName to the runner SSE path, changing /events/events/<sessionName>.
🚥 Pre-merge checks | ✅ 8
✅ Passed checks (8 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows Conventional Commits format (fix(backend): ...) and accurately describes the main change: adding thread_id to the SSE events URL.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Performance And Algorithmic Complexity ✅ Passed Change appends sessionName to events URL in listenBetweenRunEvents; simple O(1) string operation, max 30 iterations per listener, no loops/N+1/caching/unbounded growth, no algorithmic complexity re...
Security And Secret Handling ✅ Passed Change safely appends sessionName to runner SSE endpoint URL. Auth/authz properly enforced before listener starts. No secrets logged, no K8s Secrets involved. sessionName validated by K8s DNS-1123...
Kubernetes Resource Safety ✅ Passed PR modifies only Go backend code (websocket/agui_proxy.go), not Kubernetes manifests. Kubernetes resource safety check is not applicable to application code changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Comment @coderabbitai help to get the list of available commands and usage tips.

@markturansky markturansky merged commit 50a0594 into ambient-code:main Jun 15, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant